package com.homework.controller;

import com.homework.dto.CommentFormat;
import com.homework.entity.Comment;
import com.homework.service.CommentService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

@RestController
public class CommentController {

    @Resource
    private CommentService commentService;

    @RequestMapping("/findComment")
    public List<Comment> findAll(){
        List<Comment> commentList = commentService.findAll();
        return commentList;
    }

    @RequestMapping("/addComment")
    public void addComment(Comment comment){
        commentService.addComment(comment);
    }
}
